<?php
/**
 * @Copyright Copyright (C) 2010-2011 ... Webit Solution
 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
 * Company:		Webit Solution
 + Contact:		www.webitsolution.com , info@webitsolution.com
 */
?>

<?php
defined('_JEXEC') or die('Restricted access');
jimport('joomla.html.pane');
JHTML::_('behavior.formvalidation'); 
 $document =& JFactory::getDocument();
 $document->addStyleSheet('components/com_wrecruit/css/wrecruit01.css');

$host = $_SERVER['HTTP_HOST'];
$self = $_SERVER['PHP_SELF'];
$url = "http://$host$self";
?>

<script type="text/javascript">
function validateActivate() {
	var f = document.formAdmin;
	if (f.activationkey.value == ""){
		alert("Please enter Activation Key");
		f.activationkey.focus()
		return false;
	}
	return true;
}

function validateActivateKey() {
	var f = document.activateForm;
	if (f.acemailadd.value == ""){
		alert("Please enter email address");
		f.acemailadd.focus()
		return false;
	}
	if (echeck(f.acemailadd.value)==false){
		f.acemailadd.focus()
		return false
	}
	if (f.actransactionid.value == ""){
		alert("Please enter transaction id");
		f.actransactionid.focus()
		return false;
	}
	return true;
}

function validateUpdates() {
	var f = document.updateForm;
	if (f.upemailadd.value == ""){
		alert("Please enter email address");
		f.upemailadd.focus()
		return false;
	}
	if (echeck(f.upemailadd.value)==false){
		f.upemailadd.focus()
		return false
	}
	if (f.uptransactionid.value == ""){
		alert("Please enter transaction id");
		f.uptransactionid.focus()
		return false;
	}
	return true;
}

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true
}

</script>
<table width="100%" class="admintable">
	<tr>
		<td align="left" width="175"  valign="top">
			<table width="100%" ><tr><td style="vertical-align:top;">
			<?php
			include_once('components/com_wrecruit/views/menu.php');
			?>
			</td>
			</tr></table>
		</td>
		<td width="100%" valign="top" align="left">
				<?php if ($this->configur != '0'){ ?>
				<form action="http://www.wrecruit.com/wrecruitsys/checkactivate.php" method="POST" name="activateForm" target="_blank">
                                <fieldset class="adminform">
                                   <legend><?php echo JText::_('JS_GET_ACTIVATION_KEY'); ?></legend>

                                       <table cellpadding="0" cellspacing="0" border="0" width="100%" class="admintable">
                                        <tr><td height="10" colspan="3"></td></tr>

                                         <tr>
                                        <td class="key" width="35%" align="center"><?php echo JText::_('JS_PAYMENT_EMAIL_ADDRESS'); ?> :</td>
                                                <td width="50%"><input class="inputbox required" type="text" name="acemailadd" size="50" maxlength="255" value="" />   </td>
                                                <td width="15%"></td>
                                      </tr>
                                         <tr>
                                        <td class="key" align="center"><?php echo JText::_('JS_TRANSACTION_NO'); ?> / <?php echo JText::_('JS_REFERENCE_NO'); ?> : </td>
                                                  <td><input class="inputbox required" type="text" name="actransactionid" size="50" maxlength="255" value="" />
                                        </td>
                                                <td></td>
                                      </tr>
                                        <tr><td height="10" colspan="3"></td></tr>
                                          <tr>
                                                <td colspan="3" align="center" nowrap style="text-align:center;">
                                                        <input class="button" onclick="return validateActivateKey();" type="submit" name="submit_app" value="<?php echo JText::_('JS_GET_ACTIVATION_KEY'); ?>" />
                                                </td>
                                        </tr>
                                    </table>
                                   </fieldset>

						<input type="hidden" name="activateipo" value="activate" />
						<input type="hidden" name="refercode" value="<?php echo $this->configur[0]; ?>" />
						<input type="hidden" name="siteaddress" value="<?php echo $url; ?>" />
						<input type="hidden" name="vcode" value="<?php echo $this->configur[1]; ?>" />
						<input type="hidden" name="vtype" value="<?php echo $this->configur[2]; ?>" />
			  </form>

			  <br><br>
			  <form action="index.php" method="POST" name="formAdmin"  >
                                <fieldset class="adminform">
                                   <legend><?php echo JText::_('JS_ACTIVATE_WRECRUIT'); ?></legend>
                                        <table cellpadding="0" cellspacing="0" border="0" width="100%" class="admintable">
                                        <tr><td height="10" colspan="3"></td></tr>

                                         <tr>
                                        <td class="key" width="35%" align="center"><?php echo JText::_('JS_ACTIVATION_KEY'); ?> :</td>
                                                <td class="textbox" width="50%"><input class="inputbox required" type="text" name="activationkey" id="activationkey" size="50" maxlength="255" value="" />   </td>
                                                <td width="15%"></td>
                                      </tr>
                                        <tr><td height="10" colspan="3"></td></tr>
                                          <tr>
                                                <td align="center" colspan="3" nowrap style="text-align:center;">
                                                        <input class="button" onclick="return validateActivate();" type="submit" name="submit_app" value="<?php echo JText::_('JS_ACTIVATE_WRECRUIT'); ?>" />
                                                </td>
                                        </tr>
                                    </table>
                                   </fieldset>
					<input type="hidden" name="option" value="<?php echo $this->option; ?>" />
					<input type="hidden" name="task" value="saveactivate" />
			  </form>
				<br><br>
			  <form action="http://www.wrecruit.com/wrecruitsys/checkupdate.php" method="POST" name="updateForm" target="_blank" >
                                <fieldset class="adminform">
                                   <legend><?php echo JText::_('JS_UPDATE_WRECRUIT'); ?></legend>
                                        <table cellpadding="0" cellspacing="0" border="0" width="100%" class="admintable">
                                        <tr><td height="10" colspan="3"></td></tr>

                                         <tr>
                                        <td class="key" width="35%" align="center"><?php echo JText::_('JS_PAYMENT_EMAIL_ADDRESS'); ?> :</td>
                                                <td width="50%"><input class="inputbox required" type="text" name="upemailadd" size="50" maxlength="255" value="" />   </td>
                                                <td width="15%"></td>
                                      </tr>
                                         <tr>
                                        <td class="key" align="center"><?php echo JText::_('JS_TRANSACTION_NO'); ?> / <?php echo JText::_('JS_REFERENCE_NO'); ?> : </td>
                                                  <td><input class="inputbox required" type="text" name="uptransactionid" size="50" maxlength="255" value="" />
                                        </td>
                                                <td></td>
                                      </tr>
                                        <tr><td height="10" colspan="3"></td></tr>
                                          <tr>
                                                <td colspan="3" align="center" nowrap style="text-align:center;">
                                                        <input class="button" type="submit" onclick="return validateUpdates();" name="submit_app" value="<?php echo JText::_('JS_CHECK_UPDATES'); ?>" />
                                                </td>
                                        </tr>
                                    </table>
                                   </fieldset>
				<input type="hidden" name="updatejsjpo" value="update" />
						<input type="hidden" name="refercode" value="<?php echo $this->configur[0]; ?>" />
						<input type="hidden" name="siteaddress" value="<?php echo $url; ?>" />
						<input type="hidden" name="vcode" value="<?php echo $this->configur[1]; ?>" />
						<input type="hidden" name="vtype" value="<?php echo $this->configur[2]; ?>" />
			  </form>
			 <?php } else {
				echo JText::_('JS_PROBLEM_NOT_JS_JOBS_ACTIVATE');

			 } ?>

		</td>
	</tr>
	<tr>
		<td colspan="2" align="left" width="100%"  valign="top">
			<table width="100%" style="table-layout:fixed;"><tr><td style="vertical-align:top;">
			<?php
				include_once('components/com_wrecruit/views/jscr.php');
			?>
			</td>
			</tr></table>
		</td>
	</tr>

</table>
